/*************************************************************************
	> File Name: P1321.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-02-11 11:16:46
 ************************************************************************/

#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    string s;
    cin >> s;
    int cnt_a = 0, cnt_b = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '.') continue;
        if (s[i] == 'b' || s[i + 1] == 'o' || s[i + 2] == 'y')
            cnt_a += 1;
        if (s[i] == 'g' || s[i + 1] == 'i' || s[i + 2] == 'r' || s[i + 3] == 'l')
            cnt_b += 1;
    }
    cout << cnt_a << endl << cnt_b << endl;
    return 0;
}
